package cn.ywang.spring.demo.action;

import cn.ywang.spring.demo.service.impl.QueryService;
import cn.ywang.spring.framework.annotation.Autowired;
import cn.ywang.spring.framework.annotation.Controller;
import cn.ywang.spring.framework.annotation.RequestMapping;
import cn.ywang.spring.framework.annotation.RequestParam;
import cn.ywang.spring.framework.web.servlet.ModelAndView;

import java.util.HashMap;
import java.util.Map;

/**
 * @author BeatificWang
 * @date 2019/4/21 22:36
 */
@Controller
public class MyAction {

	@Autowired
	QueryService service;

	@RequestMapping("/index.html")
	public ModelAndView query(@RequestParam("name") String name) {
		System.out.println("调用成功啦");
		String result = this.service.get(name);
		Map<String, Object> model = new HashMap<>(2);
		model.put("name", name);
		return new ModelAndView("index.html", model);
	}
}
